import { toSuccess, useEntityManager } from "@sker/core"
import { KsLiveRoomDayLog } from "@sker/entities"
import { useData } from "@sker/runtime"
import { z } from "zod"


export default async () => {
    const input = z.object({
        uuid: z.string()
    })
    const body = input.parse(useData())
    return await useEntityManager(async m => {
        const list = await m.createQueryBuilder()
            .select('log.count', 'count')
            .addSelect('log.update_date', 'update_date')
            .from(KsLiveRoomDayLog, 'log')
            .where('uuid=:uuid', { uuid: body.uuid })
            .execute()
        return toSuccess(list)
    })
}
